package itsm.isperp.module.repository.knowledge;

import itsm.isperp.framework.data.domain.DataResponse;
import itsm.isperp.framework.data.mybatis.dao.CUDMapper;
import itsm.isperp.framework.web.request.JqGridRequest;
import itsm.isperp.module.dto.solr.SolrKngKnowledgeDTO;
import itsm.isperp.module.entity.knowledge.KngKnowledgeItem;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface KngKnowledgeItemMapper extends CUDMapper<KngKnowledgeItem> {

	/**
	 * 获取热门知识(前10条) 热门知识根据两个条件来定义： 1、热度：热度=阅读数+评论数×10 2、时间：最近3个月
	 * 
	 * @return List<Map>
	 */
	public List<Map<String, Object>> getTop10Item();
	
	public List<Map<String, Object>> getTop10ItemPublic();

	/**
	 * 获取知识分类统计
	 * 
	 * @return
	 */
	public List<Map<String, Object>> getCategoryCount();

	/**
	 * 获取已发布的知识
	 * 
	 * @param request
	 * @return
	 */
	public DataResponse<SolrKngKnowledgeDTO> findAllPublishedDetailByRequest(
			JqGridRequest request, @Param("contentsSql") String contentsSql);

}